Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check existence of the order in the orderbook, and add polledOrderInOrderbook #166

Merged
merged 4 commits into from
Sep 14, 2023

Conversation

anxolin
Copy link
Contributor

@anxolin anxolin commented Sep 12, 2023

This PR adds a 2 things:

  1. A new check, after we get the order that "should" be created, we double-check if it was already created or not by quering the orderbook.

  2. After we verify the existence of the order, the polling will return by default TRY_NEXT_BLOCK, but at the same time it will give the concrete order to give a different result. This will allow orders like Twap to say: "Ok, so if current part is already created, next part should be starting by this exact time, therefore it will return a TRY_AT_EPOCH overriding TRY_NEXT_BLOCK default).

This will allow orders to be polled much more efficiently, for example, DCA that trades once a month, you will not need to check every block between two months.

Also, another efficiency, is that watch towers will not need to post the orders if someone else already posted it, reducing drastically the errors of DuplicatedOrder.

Not included

Next PRs I plan to add:

  • Unit testing for all these 2 new additions
  • TWAP: Schedule next part

@anxolin anxolin requested review from mfw78 and alfetopito September 12, 2023 08:54
@github-actions
Copy link

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@coveralls
Copy link
Collaborator

coveralls commented Sep 12, 2023

Coverage Status

coverage: 75.063% (-0.8%) from 75.813% when pulling dcfd3ac on check-order-existance into c0cb55f on main.

src/composable/ConditionalOrder.ts Outdated Show resolved Hide resolved
src/composable/ConditionalOrder.ts Outdated Show resolved Hide resolved
src/composable/orderTypes/Twap.ts Show resolved Hide resolved
@alfetopito
Copy link
Contributor

The unit tests are broken :/

@anxolin anxolin requested a review from alfetopito September 12, 2023 15:15
@alfetopito
Copy link
Contributor

Unit tests are still failing.
Seems like something with the dependencies?
image

@anxolin
Copy link
Contributor Author

anxolin commented Sep 14, 2023

@alfetopito worked for me.
will review 👀

image

@anxolin
Copy link
Contributor Author

anxolin commented Sep 14, 2023

Test are ✅ GREEN!

@anxolin
Copy link
Contributor Author

anxolin commented Sep 14, 2023

@alfetopito merging, let me know if you have any other comments

@anxolin anxolin merged commit 2ca4e6b into main Sep 14, 2023
5 of 6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 14, 2023
@alfetopito alfetopito deleted the check-order-existance branch September 15, 2023 09:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants